﻿using FRMS.BUS;
using FRMS.Model;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;

namespace FRMS.DAL
{
    public class DataFactory
    {
        private static string MYSQLCONNSTR = string.Empty;
        public static IDbConnection GetSQLConnection()
        {
            IDbConnection connection;
            if (MYSQLCONNSTR == string.Empty)
            {
                //MYSQLCONNSTR = CommVars.Configuration.GetSection("MySqlConnectionString").Value;
                MYSQLCONNSTR = AppSettingsHelper.Configuration["MySqlConnectionString"];
            }
            connection = new MySqlConnection(MYSQLCONNSTR);
            return connection;
        }

        private static string QRMYSQLCONNSTR = string.Empty;
        public static IDbConnection GetQRConnection()
        {
            IDbConnection connection;
            if (QRMYSQLCONNSTR == string.Empty)
            {
                QRMYSQLCONNSTR = AppSettingsHelper.Configuration["QRCodeConnectionString"];
            }
            connection = new MySqlConnection(QRMYSQLCONNSTR);
            return connection;
        }
    }
}
